﻿<hdkuic:LayoutAwarePage
    x:Class="HDK.Demo.Pages.SemanticFeeds"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:HDK.Demo.Pages"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:hdkuic ="using:HDK.UI.Controls"
    mc:Ignorable="d">
    
    <UserControl.Resources>
        <CollectionViewSource x:Name="itemsViewSource" Source="{Binding Feeds}" ItemsPath="Items" />
        
        
        <DataTemplate x:Key="FeedItemTemplate">
            <Grid HorizontalAlignment="Left" Width="250" Height="250">
                <Border Background="{StaticResource ListViewItemPlaceholderRectBrush}">
                    <FlipView ItemsSource="{Binding Images}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <FlipView.ItemTemplate>
                            <DataTemplate>
                                <FlipViewItem>
                                    <Image Stretch="UniformToFill" Opacity="0.7">
                                        <Image.Source>
                                            <BitmapImage UriSource="{Binding}" DecodePixelHeight="250" DecodePixelWidth="250" />
                                        </Image.Source>
                                    </Image>
                                </FlipViewItem>
                            </DataTemplate>
                        </FlipView.ItemTemplate>
                        <FlipView.ItemsPanel>
                            <ItemsPanelTemplate>
                                <VirtualizingStackPanel x:Name="OuterItemsPanel" Background="Transparent" Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </FlipView.ItemsPanel>
                    </FlipView>
                </Border>
                <StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundBrush}">
                    <TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayTextBrush}" Style="{StaticResource TitleTextStyle}" Height="60" Margin="15,0,15,0"/>
                    <TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryTextBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
                </StackPanel>
            </Grid>
        </DataTemplate>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="DarkSlateGray">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <TextBlock Text="Windows 8 Metro GridView Sample" Grid.Row="0"
                   FontSize="28"
                   Margin="12 4"
                   Foreground="LightSlateGray" />

        <Button Content="switch" Grid.Row="1" Click="SwitchView" />


        <GridView
                x:Name="itemGridView"
                Grid.Row="2"
                SelectionMode="None"
                AutomationProperties.AutomationId="ItemsGridView"
                AutomationProperties.Name="Items"
            IncrementalLoadingThreshold="100"
            IncrementalLoadingTrigger="Edge"
             DataFetchSize="100"
                ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
                ItemTemplate="{StaticResource FeedItemTemplate}"
            >
        </GridView>


        <!---->
        
        
        <!--<SemanticZoom Grid.Row="2" x:Name="semanticZoom">
            <SemanticZoom.ZoomedInView>
                <GridView x:Name="gvGroupInfoCVS" 
                                AutomationProperties.AutomationId="ItemGridView"
                                AutomationProperties.Name="Grouped Items"
                                ItemTemplate="{StaticResource FeedItemTemplate}"
                                ItemsSource="{Binding Source={StaticResource groupInfoCVS}}">

                    <GridView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel Orientation="Horizontal" />
                        </ItemsPanelTemplate>
                    </GridView.ItemsPanel>
                    <GridView.GroupStyle>
                        <GroupStyle>
                            <GroupStyle.HeaderTemplate>
                                <DataTemplate>
                                    <Grid Margin="1,0,0,6" Background="Chartreuse">
                                        <TextBlock Text="{Binding Key}" Foreground="Honeydew" Margin="5" FontSize="24" FontFamily="Segoe UI Light" />
                                    </Grid>
                                </DataTemplate>
                            </GroupStyle.HeaderTemplate>
                            <GroupStyle.Panel>
                                <ItemsPanelTemplate>
                                    <VariableSizedWrapGrid Orientation="Vertical"/>
                                </ItemsPanelTemplate>
                            </GroupStyle.Panel>
                        </GroupStyle>
                    </GridView.GroupStyle>

                </GridView>
            </SemanticZoom.ZoomedInView>
            <SemanticZoom.ZoomedOutView>
                <GridView IsSwipeEnabled="True" x:Name="summaryView" IsItemClickEnabled="True"
                              Background="LightGreen">
                    <GridView.ItemTemplate>
                        <DataTemplate>
                            <Grid Background="DarkBlue">
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Text="{Binding Group.Name}" FontSize="32" Foreground="Gray" />
                                    <TextBlock Text="{Binding Group.Key}" Width="40" Height="40"
                                            Foreground="White" />
                                    <TextBlock Text="{Binding Group.Items.Count}" FontSize="24" Foreground="White" />
                                    <TextBlock Text="{Binding Group.Count}" FontSize="24" Foreground="Red" />
                                </StackPanel>


                            </Grid>
                        </DataTemplate>
                    </GridView.ItemTemplate>
                    <GridView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapGrid MaximumRowsOrColumns="4"
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center" />
                        </ItemsPanelTemplate>
                    </GridView.ItemsPanel>
                    <GridView.ItemContainerStyle>
                        <Style TargetType="ListViewItem">
                            <Setter Property="Margin"
                                    Value="4" />
                            <Setter Property="Padding"
                                    Value="10" />
                            <Setter Property="BorderBrush"
                                    Value="Gray" />
                            <Setter Property="BorderThickness"
                                    Value="1" />
                            <Setter Property="HorizontalContentAlignment"
                                    Value="Center" />
                            <Setter Property="VerticalContentAlignment"
                                    Value="Center" />
                        </Style>
                    </GridView.ItemContainerStyle>
                </GridView>
            </SemanticZoom.ZoomedOutView>
        </SemanticZoom>-->

    </Grid>
    
</hdkuic:LayoutAwarePage>